<?php include '../../entries/restful.php';

/**
 *  获取批次抄表数
 */
class Surface extends Restful{

    public function action(){
        $user = json_decode($this->session->getItem('user'),true);
        $cmt_id = $user['cmt_id'];
        $batch_id = get('batch_id');
        $assets = get('assets');
        $assets_id = get('assets_id');


        $sql = 'select id,metric_now from fee_order_item_temp where cmt_id = ? and batch_id = ? and ' . $assets . '_id = ? ';
        $arg = [$cmt_id,$batch_id,$assets_id];

        $info = Mdb::query(MDB_MAIN,$sql,$arg);
        if(empty($info)){
            return Res::eIllegal('出现严重错误，请检查！');
        }
        return Res::ok($info[0]);
    }
}

new Surface();